package com.gzwanchuang.lszg.adapter;

import android.content.Context;
import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gzwanchuang.lszg.R;
import com.gzwanchuang.lszg.help.GlideHelper;
import com.gzwanchuang.lszg.proto.Mystock;


import java.util.List;

public class ChuRuAdapter extends BaseQuickAdapter<Mystock.allocationLogList.List, BaseViewHolder> implements LoadMoreModule {
    private String userID;

    public ChuRuAdapter(Context context, List<Mystock.allocationLogList.List> dataList, String useId) {
        super(R.layout.item_chu_ru, dataList);
        userID = useId;
    }

    @Override
    protected void convert(BaseViewHolder helper, Mystock.allocationLogList.List item) {
        // 先判断是否是回拨还是调拨
        if (item.getIsThird().equals("1"))  // 回拨
        {
            helper.setText(R.id.tv_name, item.getRecipientName() + " 回拨 " + item.getMemberInitiator());
        } else {
            helper.setText(R.id.tv_name, item.getMemberInitiator() + " 划拨 " + item.getRecipientName());
        }
        helper.setText(R.id.tv_goods_name, item.getEquipment() + " / " + item.getEquipmentNum())
                .setText(R.id.tv_time, item.getEquipmentTime())
                .setText(R.id.tv_xing, item.getWord())
                .setTextColor(R.id.tv_xing, Color.parseColor(item.getColour()));
        GlideHelper.INSTANCE.loadImage(helper.getView(R.id.iv_image), item.getLogo());
    }
}
